// 杨辉三角的变形
// 找规律即可，当n是偶数输出3，奇数输出2，当n%4 == 2时，输出4

#include <iostream>
using namespace std;

int main() 
{
    int n = 0;
    cin >> n;
    if(n <= 2) cout << -1 << endl;
    else
    {
        int arr[2] = {3,2};
        if(n%4 == 2) cout << 4 << endl;
        else cout << arr[n%2] << endl; 
    }

    return 0;
}